<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="/tour/js/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	$("#idCheck1").on("click", function(){
		$.ajax({
			"url":"/tour/customer/idCheck.do",//요청 url
			"data":{"cid":$("#idCheck").val()},//요청파라미터
			"type":"post",//요청방식
			"dataType":"json",//응답 데이터의 타입
			"beforeSend":function(){
				if(!$("#idCheck").val()){
						alert("ID를 입력하세요");
						return false;
				}else if($("#idCheck").val().length<4){
						alert("4글자 이상 입력하시오");
						return false;
				}
			},
			"success":function(data){
				if(data==1){
					opener.document.join_form.cid.value = $("#idCheck").val();
					window.close();
				}else{
					alert("중복된 ID입니다.");
					return false;
				}
				
			}
		});

				
	
	});
});
</script>
</head>
<body>
ID : <input type="text" id="idCheck" name="idCheck">
<input type="button"  value="중복 확인" id="idCheck1" name="idCheck1"><br>

<p>
</body>
</html>